var WxAutoImage = require('../../js/wxAutoImageCal.js');
var WxParse = require('../wxParse/wxParse.js');
var app = getApp();
Page({
  data: {
    oid: '',
    currentTab: '',
    mc: '',//辅导班名称
    jj: '',//辅导班简介
    fy: 0,//辅导班的费用

    pris: [],//价格列表
    teas: [],//教师列表

    priarr: [],//被选中的收费
    allprice: 0 //总价格
  },
  cusImageLoad: function (e) {
    var that = this;
    that.setData(WxAutoImage.wxAutoImageCal(e));
  },

  onLoad: function (options) {
    var that = this;
    //获取传递的参数
    this.setData({
      oid: options.oid
    })

    var that = this;
    var openid = wx.getStorageSync('openid');
    if (openid == "") {
      wx.redirectTo({
        url: '../../pages/index/index'
      })
    } else {
      that.getdata();
    }
  },
  getdata: function () {//定义函数名称
    wx.showLoading({
      title: '加载中',
    })
    var that = this;

    wx.request({
      url: app.myUlife.ulifeUrl + '/wechart/orderWhk_list.html',//请求地址
      data: {//发送给后台的数据
        oid: that.data.oid
      },
      header: {//请求头
        "Content-Type": "applciation/json"
      },
      method: "GET",//get为默认方法/POST
      success: function (res) {
        that.setData({
          mc: res.data.MC,
          jj: res.data.JJ,
          pris: res.data.pris,
          teas: res.data.teas,
          fy: res.data.FY,
          allprice: res.data.FY,
        });
        wx.hideLoading()
      },
      fail: function (err) { },//请求失败
      complete: function () { }//请求完成后执行的函数
    })
  },

  /** 
    * 点击tab切换 
    */
  swichNavSwi: function (e) {
    var that = this;
    var currentTab = e.target.dataset.current;
    if (this.data.currentTab === currentTab) {
      return false;
    } else {
      that.setData({
        currentTab: currentTab
      })
    }

  },

 

})
